<?php

namespace App\Recharge\Service;

use App\Http\Controllers\Controller;
use App\Jobs\OrderCallbackNotify;
use App\Models\Admin\Supplier;
use App\Models\Mysql\XnSupplierGoods;
use Exception;
use Illuminate\Support\Facades\Log;


/**
 * 订单秒反成功
 */
class ReturnSuccessOrFailure extends Controller
{

    public function execute($supplier, $order)
    {
        $goods = XnSupplierGoods::query()->where('id',$order->gid)->first();
        match ($goods->order_status) {
            -1 => throw new Exception("不继续往下走"),
            1=>OrderCallbackNotify::dispatch($supplier, $order, true)->onQueue('merchant_notify'),
            2=>OrderCallbackNotify::dispatch($supplier, $order, false)->onQueue('merchant_notify'),
        };
    }
}
